


/*pub-1|2013-05-08 17:23:51*/
KISSY.add("Cache",
function(a) {
	var b = function(c) {
		if (! (this instanceof b)) {
			return new b(c)
		}
		this._cache = []
	};
	a.augment(b, {
		init: function() {
			return this
		},
		set: function(d, c) {
			if (a.isString(c)) {
				this.del(c, d[c])
			}
			this._cache.push(d);
			return this
		},
		getIndex: function(d, e) {
			var c = 0;
			while (this._cache[c] && this._cache[c][d] !== e) {
				c++
			}
			return c >= this._cache.length ? -1 : c
		},
		get: function(e, f) {
			var d = this.getIndex(e, f);
			var c = d >= 0 ? this._cache[d] : null;
			return c
		},
		del: function(d, e) {
			var c = this.getIndex(d, e);
			if (c >= 0) {
				this._cache.splice(c, 1)
			}
		}
	});
	return b
});
KISSY.add("Message",
function(c, d) {
	var e = c.all;
	var b = function(g, f) {
		if (c.isPlainObject(g) && g.type === 2) {
			return new d(g.msg, f)
		}
		this.wrapper = c.one(g);
		this.msg = this.wrapper && this.wrapper.one(".msg-default");
		if (!this.msg) {
			return new d(g, f)
		}
		this.title = this.wrapper && this.wrapper.one(".msg-title");
		this.content = this.wrapper && this.wrapper.one(".msg-content");
		this.source = c.isPlainObject(f) ? f: null;
		this.type = this._getType();
		this._isWeak = this.wrapper && this.wrapper.hasClass("msg-weak")
	};
	var a = function(g, f) {
		return new b(g, f)
	};
	c.augment(b, {
		change: function(g, f) {
			if (!this.msg) {
				return this
			}
			if (!this._isWeak) {
				this.wrapper.removeClass("msg-weak")
			}
			this.show();
			var g = g && g.toUpperCase() || "";
			switch (g)

{
case "OK":
case "ERROR":
case "TIPS":
case "NOTICE":
case "ATTENTION":
case "QUESTION":
case "STOP":
	this._changeType(g);
	break;
default:
	break
}
this.type = this._getType();
this._changeText(f);
return this
},
_changeType: function(g) {
	var f = this.msg.attr("class"),
	h = /\bmsg-ok\b|\bmsg-error\b|\bmsg-tips\b|\bmsg-notice\b|\bmsg-attention\b|\bmsg-question\b|\bmsg-stop\b/g;
	if (f.match(h)) {
		this.msg.attr("class", f.replace(h, "msg-" + g.toLowerCase()))
	} else {
		this.msg.addClass("msg-" + g.toLowerCase())
	}
},
_changeTitle: function(f) {
	if (!this.title || !c.isString(f)) {
		return
	}
	this.title.html(f)
},
_changeContent: function(f) {
	if (!this.content || !c.isString(f)) {
		return
	}
	this.content.html(this.source ? this.source[f] || "": f)
},
_changeText: function(f) {
	var h = c.isObject(f) && c.isString(f.title) ? f.title: "",
	g = c.isObject(f) && c.isString(f.content) ? f.content: (c.isString(f) ? f: "");
	this._changeTitle(h);
	this._changeContent(g);
	if (!h && !g && this.wrapper) {
		this.wrapper.addClass("msg-weak")
	}
},
ok: function(f) {
	this.change("ok", f);
	return this
},
error: function(f) {
	this.change("error", f);
	return this
},
tips: function(f) {
	this.change("tips", f);
	return this
},
notice: function(f) {
	this.change("notice", f);
	return this
},
attention: function(f) {
	this.change("attention", f);

return this
},
question: function(f) {
	this.change("question", f);
	return this
},
stop: function(f) {
	this.change("stop", f);
	return this
},
weak: function() {
	this.msg.replace("msg", "msg_weak");
	this.msg.replace("msg_b", "msg_b_weak")
},
_getType: function() {
	var f = "";
	if (this.msg.hasClass("msg-error")) {
		f = "ERROR"
	} else {
		if (this.msg.hasClass("msg-tips")) {
			f = "TIPS"
		} else {
			if (this.msg.hasClass("msg-attention")) {
				f = "ATTENTION"
			} else {
				if (this.msg.hasClass("msg-notice")) {
					f = "NOTICE"
				} else {
					if (this.msg.hasClass("msg-ok")) {
						f = "OK"
					}
                    else {
	if (this.msg.hasClass("msg-question")) {
		f = "QUESTION"
	} else {
		if (this.msg.hasClass("msg-stop")) {
			f = "STOP"
		}
	}
}
}
}
}
}
return f
},
isHide: function() {
	return this.wrapper.css("visibility") == "hidden" || this.wrapper.css("display") == "none"
},
hide: function() {
	this.wrapper.css("visibility", "hidden").removeClass("show").addClass("hide");
	return this
},

show:function(){this.wrapper.css("visibility","visible").removeClass("hide").addClass("show");





return this
},
laterHide: function(f) {
	c.later(this.hide, f || 2000, false, this);
	return this
}
});
return a
},
{
  
	requires: ["Message2"]
});

KISSY.add("Message2",
function(a) {
	var d = a.all;
	var b = function(f, e) {
		this.msg = a.one(f);
		if (!this.msg) {
			return
		}
		this.title = this.msg && this.msg.one(".msg-tit");
		this.content = this.msg && this.msg.one(".msg-cnt");
		this.source = a.isPlainObject(e) ? e: null;
		this.type = this._getType()
	};
	var c = function(f, e) {
		return new b(f, e)
	};
	a.augment(b, {
		change: function(f, e) {
			if (!this.msg) {
				return this
			}
			this.show();
			var f = f && f.toUpperCase() || "";
			switch (f) {
			case "OK":
			case "ERROR":
			case "TIPS":
			case "NOTICE":
			case "ATTENTION":
			case "QUESTION":
			case "STOP":
				this._changeType(f);
				break;
			default:
				break
			}
			this.type = this._getType();
			this._changeText(e);
			return this
		},
		_changeType: function(f) {
			var e = this.msg.attr("class"),
			g = /\bmsg-ok\b|\bmsg-error\b|\bmsg-tips\b|\bmsg-notice\b|\bmsg-attention\b|\bmsg-question\b|\bmsg-stop\b/g;
			if (e.match(g)) {
				this.msg.attr("class", e.replace(g, "msg-" + f.toLowerCase()))
			} else {
				this.msg.addClass("msg-" + f.toLowerCase())
			}
		},
		_changeTitle: function(e) {
			if (!this.title || !a.isString(e)) {
				return
			}
			this.title.html(e)
		},
		_changeContent: function(e) {
			if (!this.content || !a.isString(e)) {
				return
			}
			this.content.html(this.source ? this.source[e] || "": e)
		},
		_changeText: function(e) {
			var g = a.isObject(e) && a.isString(e.title) ? e.title: "",
			f = a.isObject(e) && a.isString(e.content) ? e.content: (a.isString(e) ? e: "");
			this._changeTitle(g);
			this._changeContent(f);
			if (!g && !f && this.msg) {
				this.msg.addClass("msg-weak")
			}
		},
		ok: function(e) {
			this.change("ok", e);
			return this
		},
		error: function(e) {
			this.change("error", e);
			return this
		},
		tips: function(e) {
			this.change("tips", e);
			return this
		},
		notice: function(e) {
			this.change("notice", e);
			return this
		},
		attention: function(e) {
			this.change("attention", e);



return this
},
question: function(e) {
	this.change("question", e);
	return this
},
stop: function(e) {
	this.change("stop", e);
	return this
},
weak: function() {
	this.msg.replaceClass("msg", "msg-weak");
	this.msg.replaceClass("msg-b", "msg-b-weak")
},
_getType: function() {
	var f = "",
	e = this.msg.attr("class");
	if (e.match(/\bmsg-(b-)?error\b/)) {
		f = "ERROR"
	} else {
		if (e.match(/\bmsg-(b-)?-tips\b/)) {
			f = "TIPS"
		} else {
			if (e.match(/\bmsg-(b-)?-attention\b/)) {
				f = "ATTENTION"
			} else {
				if (e.match(/\bmsg-(b-)?-notice\b/)) {
					f = "NOTICE"
				} else {
					if (e.match(/msg-ok|msg-b-ok/)) {
						f = "OK"
					} else {
						if (e.match(/\bmsg-(b-)?-question\b/)) {
							f = "QUESTION"
						} else {
							if (e.match(/\bmsg-(b-)?-stop\b/)) {
								f = "STOP"
							}
						}
					}
				}
			}
		}
	}
	return f
},
isHide: function() {
	return this.msg.css("visibility") == "hidden" || this.msg.css("display") == "none"
},
hide: function() {
	this.msg.css("visibility", "hidden").removeClass("show").addClass("hide");
	return this
},
show: function() {
	this.msg.css("visibility", "visible").removeClass("hide").addClass("show");
	return this
},
laterHide: function(e) {
	a.later(this.hide, e || 2000, false, this);
	return this
}
});
return c
});




KISSY.add("PlaceHolder",
function(a) {
	var c = function(d) {
		this.input = d.input && a.one(d.input);
		this.placeholder = d.placeholder && a.one(d.placeholder);
		this.blurCls = d.blurCls || "ph_blur"
	};
	var b = function(d) {
		return new c(d)
	};
	a.augment(c, {
		init: function() {
			if (!this.input || !this.placeholder || this.input.val()) {
				return this
			}
			var d = this;
			this.placeholder.show();
			this.fix();
			this.placeholder.on("click",
			function() {
				d.input.fire("focus")
			});
			this.input.on("valuechange",
			function() {
				if (d.input.val().length) {
					d.placeholder.hide()
				} else {
					d.placeholder.show();
					d.fix();
					d.placeholder.addClass(d.blurCls)
				}
			}).on("blur",
			function() {
				if (!d.input.val().length) {
					d.placeholder.show();
					d.fix();
					d.placeholder.removeClass(d.blurCls)
				}
			}).on("focus",
			function() {
				if (d.input.val().length) {
					d.placeholder.hide()
				} else {
					d.placeholder.show();
					d.fix();
					d.placeholder.addClass(d.blurCls)
				}
			});
			a.one(window).on("resize",
			function() {
				d.fix()
			});
			return this
		},
		fix: function() {
			var d = this.input.offset();
			this.placeholder.css({
				position: "absolute",
				left: d.left + 7
			}).css({
				top: d.top + Math.floor((this.input[0].clientHeight + 2 - this.placeholder[0].clientHeight) / 2)
			})
		}
	});
	return b
});




KISSY.add("CheckCode",
function(b) {
	var a = b.DOM,
	o = b.Event,
	g = 1,
	k = /^[\da-zA-Z]{4}$/,
	e = navigator.userAgent.indexOf("Windows") !== -1,
	m = b.UA.ie,
	c = b.UA.firefox,
	l = ".{{prefixCls}}checkcode-img,.{{prefixCls}}checkcode-audio{width:175px;height:32px;line-height:32px;position:absolute;}.{{prefixCls}}checkcode-audio{display:none;}.{{prefixCls}}checkcode-img img,.{{prefixCls}}checkcode-audio audio{float:left;display:inline;width:100px;height:30px;border:1px solid #CDCDCD;cursor:pointer;}.{{prefixCls}}checkcode-refresh{display:none;width:100px;height:30px;vertical-align:middle;border:1px solid #CDCDCD;position:absolute;left:0;top:0;cursor:pointer;}.{{prefixCls}}audio-state{float:left;display:inline;width:100px;height:30px;border:1px solid #CDCDCD;position:relative;}.{{prefixCls}}audio-state-text{display:block;width:70px;height:30px;padding-left:30px;font-size:12px;color:#999;text-decoration:none;background:url(http://img01.taobaocdn.com/tps/i1/T1HVriXnVeXXbjRy2i-21-169.png) no-repeat 10px -93px;z-index:1;position:absolute;cursor:text;}.{{prefixCls}}audio-state-text:hover{text-decoration:none;}.{{prefixCls}}audio-state-progress{width:0;height:30px;background-color:#186BCA;position:absolute;left:0;top:0;z-index:0;}.{{prefixCls}}audio-over{width:100px;padding-left:0;color:#186BCA;text-align:center;background:none;cursor:pointer;}.{{prefixCls}}audio-over:hover{text-decoration:underline;}.{{prefixCls}}checkcode-refresher{float:left;display:inline;width:32px;height:32px;vertical-align:top;text-indent:-9999em;outline:none;border-right:1px solid #DDD;background:url(http://img01.taobaocdn.com/tps/i1/T1HVriXnVeXXbjRy2i-21-169.png) no-repeat 7px -145px;}.{{prefixCls}}checkcode-switcher{float:left;display:inline;width:32px;height:32px;vertical-align:top;text-indent:-9999em;outline:none;background:url(http://img01.taobaocdn.com/tps/i1/T1HVriXnVeXXbjRy2i-21-169.png) no-repeat 0 0;}.{{prefixCls}}checkcode-refresher,.{{prefixCls}}checkcode-switcher{filter:alpha(opacity=70);opacity:0.7;}.{{prefixCls}}checkcode-refresher:hover,.{{prefixCls}}checkcode-switcher:hover{filter:alpha(opacity=100);opacity:1;border-color:#EAEAEA;}.{{prefixCls}}audio-switcher{background-position:6px -40px;}.{{prefixCls}}img-switcher{background-position:5px 10px;}",
	f = {
		template: '<div class="{prefixCls}checkcode-img" id="J_ImgCode{uid}"><img id="J_CheckCodeImg{uid}" width="100" height="30" onmousedown="return false;"/><a href="#nogo" onmousedown="return false;" role="button" title="\u91cd\u65b0\u83b7\u53d6\u9a8c\u8bc1\u7801" aria-label="\u91cd\u65b0\u83b7\u53d6\u9a8c\u8bc1\u7801" id="J_ImgRefresher{uid}" class="{prefixCls}checkcode-refresher">\u91cd\u65b0\u83b7\u53d6\u9a8c\u8bc1\u7801</a><a href="#nogo" onmousedown="return false;" role="button" title="\u83b7\u53d6\u8bed\u97f3\u9a8c\u8bc1\u7801" aria-label="\u83b7\u53d6\u8bed\u97f3\u9a8c\u8bc1\u7801" id="J_AudioSwitcher{uid}" class="{prefixCls}checkcode-switcher {prefixCls}audio-switcher">\u83b7\u53d6\u8bed\u97f3\u9a8c\u8bc1\u7801</a></div><div class="{prefixCls}checkcode-audio" id="J_AudioCode{uid}"><span class="{prefixCls}audio-state" id="J_AudioState{uid}"><a href="#nogo" class="{prefixCls}audio-state-text" id="J_AudioStateText{uid}" onmousedown="return false;"></a><span class="{prefixCls}audio-state-progress" id="J_AudioStateProgress{uid}"></span></span><a href="#nogo" role="button" onmousedown="return false;" title="\u91cd\u65b0\u83b7\u53d6\u9a8c\u8bc1\u7801" aria-label="\u91cd\u65b0\u83b7\u53d6\u9a8c\u8bc1\u7801" id="J_AudioRefresher{uid}" class="{prefixCls}checkcode-refresher">\u91cd\u65b0\u83b7\u53d6\u9a8c\u8bc1\u7801</a><a href="#nogo" role="button" onmousedown="return false;" title="\u83b7\u53d6\u56fe\u7247\u9a8c\u8bc1\u7801" aria-label="\u83b7\u53d6\u56fe\u7247\u9a8c\u8bc1\u7801" id="J_ImgSwitcher{uid}" class="{prefixCls}checkcode-switcher {prefixCls}img-switcher">\u83b7\u53d6\u56fe\u7247\u9a8c\u8bc1\u7801</a></div>',
		getImgURL: "{apiserver}/get_img?identity={identity}&sessionid={sessionid}&kjtype=default",
		checkImgURL: "{apiserver}/check_img?identity={identity}&sessionid={sessionid}&delflag=0",
		getAudioURL: "{apiserver}/get_audio?identity={identity}&sessionid={sessionid}",
		checkAudioURL: "{apiserver}/check_audio?identity={identity}&sessionid={sessionid}&delflag=0"
	},
	j = b.now(),
	d = b.now(),
	h = {};
	var n = function(p) {
		if (! (this instanceof n)) {
			return new n(p)
		}
		this.input = p.input && b.one(p.input);
		this.container = p.container && b.one(p.container);
		this.prefixCls = b.isString(p.prefixCls) ? p.prefixCls: "";
		this.identity = b.isString(p.identity) ? p.identity: "";
		this.sessionid = b.isString(p.sessionid) ? p.sessionid: "";
		this.apiserver = b.isString(p.apiserver) && p.apiserver ? p.apiserver: "http://pin.aliyun.com";
		this.checkedCode = "";
		this.uid = g++
	};
	b.augment(n, b.EventTarget, {
		init: function() {
			if (!this.container || !this.input || !this.identity || !this.sessionid) {
				return
			}
			if (this.INITED) {
				return this
			}
			this.createStyle();
			this.create();
			this.bind();
			this.INITED = true;
			return this
		},
		createStyle: function() {
			var p = l.replace(/{{prefixCls}}/g, this.prefixCls),
			q = a.create("<style>", {
				type: "text/css"
			});
			if (q.styleSheet) {
				q.styleSheet.cssText = p
			} else {
				q.appendChild(document.createTextNode(p))
			}
			a.append(q, "head")
		},
		create: function() {
			var r = this.uid;
			var q = b.substitute(f.template, {
				prefixCls: this.prefixCls,
				uid: r
			});
			this.container.html(q);
			this.imgCode = b.one("#J_ImgCode" + r);
			this.audioCode = b.one("#J_AudioCode" + r);
			this.imgSwitcher = b.one("#J_ImgSwitcher" + r);
			this.audioSwitcher = b.one("#J_AudioSwitcher" + r);
			this.refresher = b.all("." + this.prefixCls + "checkcode-refresher");
			this.img = b.one("#J_CheckCodeImg" + r);
			this.audioState = b.one("#J_AudioState" + r);
			this.audioStateText = b.one("#J_AudioStateText" + r);
			this.audioProgress = b.one("#J_AudioStateProgress" + r);
			var p = {
				apiserver: this.apiserver,
				identity: this.identity,
				sessionid: this.sessionid
			};
			this.getImgURL = b.substitute(f.getImgURL, p);
			this.checkImgURL = b.substitute(f.checkImgURL, p);
			this.getAudioURL = b.substitute(f.getAudioURL, p);
			this.checkAudioURL = b.substitute(f.checkAudioURL, p);
			this.CREATED = true
		},
		bind: function() {
			var p = this;
			this.bindImg();
			this.bindAudio();
			this.refresher.on("click",
			function(q) {
				q.halt();
				p.refresh();
				p.focus()
			});
			this.input.on("valuechange",
			function(q) {
				if ((!q.prevVal || q.prevVal.length === 0 || q.prevVal.length === 4) && q.newVal.length === 1) {
					d = b.now()
				}
			}).on("paste",
			function() {
				if (this.value.length !== 0) {
					return
				}
				d = b.now()
			})
		},
		bindImg: function() {
			if (!this.img) {
				return this
			}
			var p = this;
			this.img && this.img.on("click",
			function() {
				p.refresh();
				p.focus()
			}).on("load",
			function() {}).on("error",
			function() {
				p.log({
					e: "IMGERROR"
				})
			});
			this.imgSwitcher && this.imgSwitcher.on("click",
			function(q) {
				q.halt();
				p.switchTo("img");
				p.focus()
			});
			return this
		},
		bindAudio: function() {
			var p = this;
			this.audioSwitcher.on("click",
			function(q) {
				q.halt();
				p.switchTo("audio");
				p.refresh();
				p.focus()
			});
			this.audioStateText.on("click",
			function(q) {
				q.halt();
				if (!p.audioOver) {
					return
				}
				p.refresh();
				p.focus()
			});
			return this
		},
		bindAudioProgress: function() {
			var p = this;
			if (this.audioSupport) {
				this.audio.on("timeupdate",
				function() {
					if (c && (!this.duration || this.duration === Infinity)) {
						p.progress(100)
					} else {
						p.progress(parseInt(100 * this.currentTime / this.duration))
					}
				},
				this.audio[0]).on("play",
				function() {},
				this.audio[0]).on("ended",
				function() {
					p.progress(100)
				},
				this.audio[0])
			}
		},
		switchTo: function(p) {
			if (!p || !b.isString(p)) {
				return this
			}
			var p = p.toUpperCase();
			if (p === "IMG") {
				this.audioCode.hide();
				this.stopAudio();
				this.imgCode.css({
					display: "block"
				});
				this.codeType = p
			} else {
				if (p === "AUDIO") {
					this.imgCode.hide();
					this.audioProgress.width(0);
					this.audioStateText.removeClass(this.prefixCls + "audio-replay");
					this.audioCode.css({
						display: "block"
					});
					this.codeType = p
				}
			}
			this.checkedCode = "";
			this.toggleRefresher();
			this.SHOWED = true;
			this.fire("switch");
			return this
		},
		toggleRefresher: function() {
			if (this.codeType !== "AUDIO") {
				this.refresher.show();
				return
			}
			if (!this.audioSupport || c) {
				this.refresher.hide()
			}
		},
		refreshImg: function() {
			if (!this.getImgURL) {
				return this
			}
			var p = this.getImgURL + (this.getImgURL.indexOf("?") >= 0 ? "&t=": "?t=") + b.now();
			this.img.attr("src", p);
			return this
		},
		refreshAudio: function() {
			if (!this.getAudioURL) {
				return this
			}
			var p = this.getAudioURL + (this.getAudioURL.indexOf("?") >= 0 ? "&t=": "?t=") + b.now();
			this.stopAudio();
			this.audioOver = false;
			if (this.audioSupport) {
				this.audioDuration = 0;
				this.audio = b.one(new Audio(p));
				this.audio[0].play();
				this.bindAudioProgress()
			} else {
				if (!m) {
					b.one("body").append('<embed src="' + p + '" id="J_EmbedSound' + this.uid + '"' + (e ? 'type="application/x-mplayer2"': 'type="audio/x-wav"') + " autostart hidden />");
					this.player = b.one("#J_EmbedSound" + this.uid);
					this.progress("NOPROGRESS")
				} else {
					var q = a.create("<bgsound>", {
						autostart: true,
						id: "J_BgSound" + this.uid,
						src: p
					});
					a.append(q, "head");
					this.player = b.one("#J_BgSound" + this.uid);
					this.progress("NOPROGRESS")
				}
			}
			return this
		},
		refresh: function(p) {
			var p = b.isString(p) && p ? p.toUpperCase() : this.codeType;
			if (p === "IMG") {
				this.refreshImg()
			} else {
				if (p === "AUDIO") {
					this.refreshAudio()
				}
			}
			this.checkedCode = "";
			this.fire("refresh");
			j = d = b.now()
		},
		focus: function() {
			this.input[0].focus();
			this.input[0].select()
		},
		stopAudio: function() {
			if (this.audioSupport) {
				if (this.audio && this.audio[0]) {
					this.audio[0].pause()
				}
			} else {
				if (this.player) {
					this.player[0].src = "";
					this.player.remove();
					this.player = null
				}
			}
		},
		replayAudio: function() {
			if (!this.audioSupport || !this.audio) {
				return
			}
			this.audio[0].currentTime = 0;
			this.audio[0].pause();
			this.audio[0].play()
		},
		showImg: function() {
			this.switchTo("img");
			this.refresh();
			return this
		},
		showAudio: function() {
			this.switchTo("audio");
			return this
		},
		audioSupport: (function() {
			try {
				return "Audio" in window && (new Audio()).canPlayType("audio/x-wav")
			} catch(p) {
				return false
			}
		})(),
		progress: function(p) {
			switch (p) {
			case - 1 : this.audioStateText.text("\u6b63\u5728\u52a0\u8f7d");
				break;
			case 100:
			case "NOPROGRESS":
				this.audioOver = true;
				this.audioProgress.css({
					width: "0"
				});
				this.audioStateText.addClass(this.prefixCls + "audio-over").text("\u70b9\u51fb\u64ad\u653e\u8bed\u97f3");
				break;
			default:
				this.audioStateText.removeClass(this.prefixCls + "audio-over").text("\u8bf7\u4ed4\u7ec6\u6536\u542c");
				this.audioProgress.css({
					width: p + "%"
				});
				break
			}
		},
		check: function(q) {
			var p = b.trim(this.input.val()),
			q = b.isFunction(q) ? q: function() {};
			if (!k.test(p)) {
				q({
					success: false,
					codeType: this.codeType
				});
				return
			}
			if (this.checkedCode && this.checkedCode === p) {
				q({
					success: true,
					codeType: this.codeType
				});
				return
			}
			h[p] = q;
			if (this.checkingCode) {
				if (this.checkingCode === p) {
					return
				} else {
					this.io && this.io.abort && this.io.abort()
				}
			}
			this.checkingCode = p;
			b.later(function() {
				this._check(q)
			},
			500, false, this)
		},
		_check: function(t) {
			var p = this.codeType == "IMG" ? this.checkImgURL: this.checkAudioURL,
			s = b.trim(this.input.val());
			var q = this;
			q.io = b.io({
				url: p,
				data: {
					code: s
				},
				dataType: "jsonp",
				success: function(u) {
					q.checkingCode = "";
					q.log({
						t1: b.now() - d,
						t2: b.now() - j,
						s: u && u.message === "SUCCESS.",
						t: q.codeType
					});
					if (u && u.message === "SUCCESS.") {
						q.progress(100);
						q.stopAudio();
						q.checkedCode = s;
						h[s] && h[s]({
							success: true,
							codeType: q.codeType
						})
					} else {
						r()
					}
				},
				error: function() {
					r()
				}
			});
			function r() {
				if (q.codeType === "IMG") {
					q.refresh()
				} else {
					q.progress(100);
					q.stopAudio()
				}
				q.checkedCode = "";
				h[s] && h[s]({
					success: false,
					codeType: q.codeType
				})
			}
		},
		log: function(q) {
			if (!q) {
				return
			}
			var p = new Image();
			p.src = "http://acjs.aliyun.com/captchaerror?" + b.param(q)
		}
	});
	b.checkcode = n;
	return n
});
KISSY.add("SuperCheckCode",
function(d, b, c) {
	var a = function(e) {
		if (! (this instanceof a)) {
			return new a(e)
		}
		this.input = e.input && d.one(e.input);
		this.errCls = d.isString(e.errCls) && e.errCls || "";
		this.container = e.container && d.one(e.container);
		this.defaultType = d.isString(e.defaultType) ? e.defaultType: "img";
		this.apiserver = e.apiserver;
		this.identity = e.identity;
		this.sessionid = e.sessionid;
		this.prefixCls = d.isString(e.prefixCls) ? e.prefixCls: "";
		this.checkData = d.isPlainObject(e.checkData) && e.checkData || {};
		this.checkCallback = d.isFunction(e.checkCallback) ? e.checkCallback: function() {};
		this.tip = e.tip && d.one(e.tip) ? c(e.tip) : null;
		this.checkOn = e.on || "keyup blur";
		this.defaultTip = e.defaultTip || null;
		this.disabledMsg = d.isString(e.disabledMsg) ? e.disabledMsg: "\u9a8c\u8bc1\u7801\u683c\u5f0f\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01";
		this.disabled = true;
		this.stat = {
			code: 0,
			msg: ""
		};
		this.checkcode = null;
		this.codeType = ""
	};
	d.augment(a, d.Event.Target, {
		ctype: "CHECKER",
		statusCode: {
			netError: {
				code: -1,
				msg: "\u7f51\u7edc\u9519\u8bef"
			},
			empty: {
				code: 1,
				msg: "\u4e0d\u80fd\u4e3a\u7a7a"
			},
			formatError: {
				code: 2,
				msg: "\u9a8c\u8bc1\u7801\u683c\u5f0f\u9519\u8bef"
			},
			ajaxError: {
				code: 3,
				msg: "\u9a8c\u8bc1\u7801\u9519\u8bef"
			},
			ok: {
				code: 100,
				msg: ""
			}
		},
		init: function() {
			if (!this.input || !this.container || !this.identity || !this.sessionid) {
				return this
			}
			var e = this;
			this.checkcode = b({
				input: e.input,
				container: e.container,
				apiserver: e.apiserver,
				identity: e.identity,
				sessionid: e.sessionid,
				prefixCls: e.prefixCls
			});
			this.validate(true);
			this.input.on(this.checkOn,
			function() {
				e.validate(false, true)
			});
			return this
		},
		validate: function(f) {
			var g = this;
			var e = arguments,
			f = d.isPlainObject(e[0]) ? e[0] : {
				def: !!e[0],
				async: !!e[1],
				callback: null,
				context: window
			};
			var k = f.def,
			j = f.async,
			l = f.callback,
			h = f.context;
			this.checkAble(function(m) {
				g.validateCallback(k);
				d.isFunction(l) && l.call(this, m)
			},
			j, h)
		},
		validateCallback: function(e) {
			if (e && this.tip.type.toLowerCase() == "error" && !this.tip.isHide()) {
				return this.disabled
			}
			this.check(e); ! e && this.checkCallback(this.disabled);
			return this.disabled
		},
		check: function(e) {
			if (e && !d.trim(this.input.val())) {
				this.reset();
				return
			}
			switch (this.stat.code) {
			case 1:
			case 2:
			case 3:
				this.tip.error(this.stat.msg);
				this.input.removeClass(this.errCls);
				d.later(function() {
					this.input.addClass(this.errCls)
				},
				1, false, this);
				break;
			case 100:
				this.tip.ok();
				this.input.removeClass(this.errCls);
				break;
			default:
				break
			}
		},
		checkAble: function(j, g, f) {
			var e = this,
			h;
			var f = f || e,
			g = !!g,
			j = d.isFunction(j) && j ||
			function() {};
			if (!d.trim(this.input.val()).length) {
				this.disabled = true;
				this.disabledMsg = "\u9a8c\u8bc1\u7801\u4e0d\u80fd\u4e3a\u7a7a";
				this.stat = this.statusCode.empty;
				j.call(f, e.disabled);





return
} else {
	if (!d.trim(this.input.val()).match(/^[\da-zA-Z]{4,6}$/)) {
		this.disabled = true;
		this.disabledMsg = "\u9a8c\u8bc1\u7801\u683c\u5f0f\u9519\u8bef";
		this.stat = this.statusCode.formatError
	} else {
		this.disabled = false;
		this.stat = this.statusCode.ok
	}
}
if (e.disabled || !g) {
	j.call(f, e.disabled);
	return
}
if (!this.checkcode || !this.checkcode.INITED || !this.checkcode.SHOWED) {
	j.call(f, e.disabled);
	return
}
this.checkcode.check(function(k) {
	if (k.success) {
		e.disabled = false;
		e.stat = e.statusCode.ok
	} else {
		e.disabled = true;
		e.stat = e.statusCode.ajaxError
	}
	j.call(f, e.disabled);
	e.checkCallback(e.disabled)
})
},
reset: function() {
	this.input && this.input.val("") && this.input.removeClass(this.errCls);
	this.resetTip();
	return this
},
resetTip: function() {
	if (!this.tip) {
		return this
	}
	if (this.defaultTip && this.defaultTip.type && this.defaultTip.msg) {
		this.tip.change(this.defaultTip.type, this.defaultTip.msg)
	} else {
		this.tip.hide()
	}
},
showCode: function(f) {
	var f = f || this.defaultType,
	e = this;
	if (this.checkcode && !this.checkcode.SHOWED) {
		if (!this.checkcode.INITED) {
			this.checkcode.init();
			this.checkcode.on("switch",
			function() {
				e.disabled = true;
				e.tip.hide();
				e.codeType = this.codeType;
				e.fire("switch")
			}).on("refresh",
			function() {
				e.disabled = true;
				e.tip.hide();
				e.fire("refresh")
			})
		}
		if (f.toLowerCase() === "audio") {
			this.checkcode.showAudio()
		} else {
			this.checkcode.showImg()
		}
	}
	this.INITED = this.checkcode && this.checkcode.INITED;
	this.SHOWED = this.checkcode && this.checkcode.SHOWED
}
});
return a
},
{
	requires: ["CheckCode", "Message"]
});

KISSY.add("UserName",
function(b, a, f, d) {
	var c = function(g) {
		this.type = (g.type || "REG").toUpperCase();
		this.input = g.input && b.one(g.input);
		this.errCls = b.isString(g.errCls) && g.errCls || "";
		this.placeholder = g.placeholder && g.input ? f({
			input: g.input,
			placeholder: g.placeholder,
			blurCls: "ph_blur"
		}) : null;
		this.checkUrl = g.checkUrl || "";
		this.checkData = b.isPlainObject(g.checkData) && g.checkData || {};
		this.checkCallback = b.isFunction(g.checkCallback) ? g.checkCallback: function() {};
		this.tip = g.tip && b.one(g.tip) ? a(g.tip) : null;
		this.timeout = b.isNumber(g.timeout) ? g.timeout: 0;
		this.suggestNick = g.suggestNick && b.one(g.suggestNick);
		this.suggestNickList = g.suggestNickList && b.one(g.suggestNickList);
		this.suggestNickKey = b.isString(g.suggestNickKey) && g.suggestNickKey || "";
		this.suggestAutoClose = !!g.suggestAutoClose;
		this.recommendNick = null;
		this.suggestNickTemplate = '<li><input type="radio" name="chk-nick" class="i_radio_nick" value="{nick}" {checked} id="chk-{id}" /><label for="chk-{id}">{nick}</lable></li>';
		this.on = g.on || "keyup blur";
		this.defaultOn = g.defaultOn || "";
		this.defaultTip = g.defaultTip || null;
		this.tipMsg = b.isPlainObject(g.tipMsg) ? g.tipMsg: {};
		this.msgTemplate = b.isObject(g.msgTemplate) ? g.msgTemplate: null;
		this.disabledMsg = b.isString(g.disabledMsg) ? g.disabledMsg: "\u7528\u6237\u540d\u8f93\u5165\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01";
		this.disabled = true;
		this.stat = {
			code: 0,
			msg: ""
		};
		this.cache = !!g.cache ? d().init() : null;
		this.async = false;
		this.asyncRetData = null
	};
	var e = function(g) {
		return new c(g)
	};
	b.augment(c, {
		ctype: "CHECKER",
		statusCode: {
			netError: {
				code: -1,
				msg: "\u7f51\u7edc\u9519\u8bef"
			},
			empty: {
				code: 1,
				msg: "\u4e0d\u80fd\u4e3a\u7a7a"
			},
			formatError: {
				code: 2,
				msg: "\u7528\u6237\u540d\u683c\u5f0f\u9519\u8bef"
			},
			ajaxError: {
				code: 3,
				msg: "\u7528\u6237\u540d\u9519\u8bef"
			},
			sizeError: {
				code: 4,
				msg: "5-25\u4e2a\u5b57\u7b26"
			},
			allNumberError: {
				code: 5,
				msg: "\u4e0d\u80fd\u5168\u4e3a\u6570\u5b57"
			},
			illegalError: {
				code: 6,
				msg: "\u5305\u542b\u975e\u6cd5\u5b57\u7b26"
			},
			ok: {
				code: 100,
				msg: ""
			}
		},
		regex: {
			illegal: /[~\uff5e]|[!\uff01]|[?\uff1f]|\.\.|--|__|\uff0d|\uff3f|\u203b|\u25b2|\u25b3|\u3000| |@/,
			allNumber: /^\d+$/
		},
		init: function() {
			if (!this.input || !this.tip) {
				return this
			}
			this.placeholder && this.placeholder.init();
			var g = this;
			this.validate(true, false);
			this.input.on(this.on,
			function() {
				b.later(function() {
					g.validate(false, true)
				},
				g.timeout, false, this)
			});
			this.defaultOn && (this.input.on(this.defaultOn,
			function() { ! b.trim(g.input.val()) && g.reset()
			}));
			this.suggestNickList && this.suggestNickKey && b.Event.delegate(document, "click", ".i_radio_nick",
			function(h) {
				g.input.val(h.currentTarget.value);
				if (g.suggestAutoClose) {
					g.suggestNick.hide()
				}
				g.validate()
			});
			return this
		},
		validate: function(h) {
			if (!this.input) {
				this.disabled = false;
				return this.disabled
			}
			var j = this;
			var g = arguments,
			h = b.isPlainObject(g[0]) ? g[0] : {
				def: !!g[0],
				async: !!g[1],
				callback: null,
				context: window
			};
			var m = h.def,
			l = h.async,
			n = h.callback,
			k = h.context;
			this.checkAble(function(o) {
				j.validateCallback(m);
				b.isFunction(n) && n.call(this, o)
			},
			l, k)
		},
		validateCallback: function(g) {
			if (g && this.tip.type.toLowerCase() == "error" && !this.tip.isHide()) {
				return this.disabled
			}
			this.check(g);
			if (!this.recommendNick) {
				this.suggestNick && this.suggestNick.hide()
			} else {
				if (this.async) {
					this.updateSuggestList()
				}
			}
			this.async && this.updateSuggestList(); ! g && this.checkCallback(this.disabled, this.asyncRetData, this.recommendNick);
			return this.disabled
		},
		updateSuggestList: function() {
			if (!this.recommendNick) {
				return
			}
			var h = this.suggestNickTemplate,
			g = this;
			var j = "";
			b.each(this.recommendNick,
			function(k, l) {
				j += b.substitute(h, {
					id: "nick_" + l,
					nick: k,
					checked: k === g.input.val() ? "checked": ""
				})
			});
			this.suggestNickList.html(j);
			this.suggestNick.show()
		},
		check: function(g) {
			if (g && !b.trim(this.input.val())) { ! this.defaultOn && this.reset();
				return
			}
			switch (this.stat.code) {
			case - 1 : case 1:
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
				this.tip.error(this.stat.msg);
				this.input.removeClass(this.errCls);
				b.later(function() {
					this.input.addClass(this.errCls)
				},
				1, false, this);
				break;
			case 100:
				this.tip.ok(this.tipMsg.ok || "");
				this.input.removeClass(this.errCls);
				break;
			default:
				break
			}
		},
		checkAble: function(m, k, j) {
			var h = this,
			l, g;
			var j = j || h,
			k = !!k,
			m = b.isFunction(m) && m ||
			function() {};
			this.asyncRetData = null;
			this.recommendNick = null;
			h.async = k;
			if (!b.trim(h.input.val()).length) {
				h.disabled = true;
				h.stat = h.statusCode.empty;
				m.call(j, h.disabled);
				return
			} else {
				if (!h.cache || h.cache.getIndex("value", h.input.val()) == -1) {
					if (l = h._checkAble()) {
						h.disabled = true;
						if (h.type == "REG") {
							switch (l) {
							case 4:
								h.stat = h.statusCode.sizeError;
								break;
							case 5:
								h.stat = h.statusCode.allNumberError;
								break;
							case 6:
								h.stat = h.statusCode.illegalError;
								break;
							default:
								break
							}
						} else {
							h.stat = h.statusCode.formatError
						}
					} else {
						h.disabled = false;
						h.stat = h.statusCode.ok
					}
					if (!h.checkUrl || h.disabled || !k) {
						if (h.cache) {
							g = h._updateCache();
							h.cache.set(g, "value")
						}
						m.call(j, h.disabled);
						return
					}
					b.io({
						url: h.checkUrl,
						data: b.mix(h.checkData, {
							nick: b.trim(h.input.val())
						}),
						type: "post",
						dataType: "json",
						success: function(n) {
							var o = n.msg || n.reason || "";
							o = h.msgTemplate ? h.msgTemplate[o] || o: o;
							if (n.success) {
								h.disabled = false;
								h.stat = {
									code: h.statusCode.ok.code,
									msg: o || h.statusCode.ok.msg
								};
								h.recommendNick = null
							} else {
								h.disabled = true;
								h.stat = {
									code: h.statusCode.ajaxError.code,
									msg: o || h.statusCode.ajaxError.msg
								};
								h.recommendNick = h.suggestNick && h.suggestNickList && h.suggestNickKey ? n[h.suggestNickKey] : null
							}
							this.asyncRetData = n;
							m.call(j, h.disabled);
							if (h.cache) {
								g = h._updateCache();
								h.cache.set(g, "value")
							}
						},
						error: function() {
							this.asyncRetData = null;
							h.stat = {
								code: h.statusCode.netError.code,
								value: b.trim(h.input.val()),
								msg: h.statusCode.netError.msg
							};
							h.recommendNick = null;
							m.call(j, h.disabled)
						}
					})
				} else {
					g = h.cache.get("value", h.input.val());
					h.disabled = g.disabled;
					h.stat = g.stat;
					h.recommendNick = g.recommendNick;
					m.call(j, h.disabled)
				}
			}
		},
		_checkAble: function() {
			var h = 0,
			g;
			if (!this.matchSize()) {
				h = 4
			} else {
				if (this.type == "REG" && this.isAllNumber()) {
					h = 5
				} else {
					if (g = this.isIllegal()) {
						this.statusCode.illegalError = {
							code: 6,
							msg: "\u5305\u542b\u975e\u6cd5\u5b57\u7b26" + g
						};
						h = 6
					}
				}
			}
			return h
		},
		_updateCache: function() {
			return {
				value: b.trim(this.input.val()),
				disabled: this.disabled,
				stat: this.stat,
				recommendNick: this.recommendNick
			}
		},
		_updateRecommendNick: function() {
			if (!this.recommendNick || !this.recommendNick.length) {
				return this
			}
			var h = "",
			g = 0;
			while (g < this.recommendNick.length) {
				h += b.substitute(this.suggestNickListTemplate, {
					index: g,
					nick: this.recommendNick[g]
				});
				g++
			}
			this.suggestNickList.html(h);
			return this
		},
		isAllNumber: function() {
			return !! this.input.val().match(this.regex.allNumber)
		},
		isIllegal: function() {
			var g = this.input.val().match(this.regex.illegal);
			return g ? g.join(" ") : ""
		},
		size: function() {
			return b.trim(this.input.val()).replace(/[^\x00-\xff]/g, "**").length
		},
		matchSize: function() {
			var g = this.type == "REG" ? 5 : 2;
			return this.size() >= g && this.size() <= (this.type == "REG" ? 25 : 9999)
		},
		reset: function() {
			this.input && this.input.removeClass(this.errCls);
			this.resetTip();



























return this
},
resetTip: function() {
	if (!this.tip) {
		return this
	}
	if (this.defaultTip && this.defaultTip.type && this.defaultTip.msg) {
		this.tip.change(this.defaultTip.type, this.defaultTip.msg)
	} else {
		this.tip.hide()
	}
	return this
}
});
return e
},
{
	requires: ["Message", "PlaceHolder", "Cache"]
});


KISSY.add("PasswordCore",
function(b) {
	var a = function(d) {
		this.password = d || ""
	};
	var c = function(d) {
		return new a(d)
	};


b.augment(a,{regex:{illegal:/[^-+=|,0-9a-zA-Z!@#$%^&*?_.~+/\\(){}\[\]<>]/g,allNumber:/^\d+$/,allLetter:/^[a-zA-Z]+$/,allCharacter:/^[-+=|,!@#$%^&*?_.~+/\\(){}\[\]<>]+$/,allSame:/^([\s\S])\1*$/,number:/\d/g,letter:/[a-zA-Z]/g,lowerAndUpperLetter:/[a-z][^A-Z]*[A-Z]|[A-Z][^a-z]*[a-z]/,numberAndLetter:/\d[^a-zA-Z]*[a-zA-Z]|[a-zA-Z][^\d]*\d/,character:/[-+=|,!@#$%^&*?_.~+/\\()|{}\[\]<>]/g},
score:function(){var g=0;if(this.isIllegal()){return g}var j=this.size();


if (j <= 4) {
	g += 5
} else {
	if (j > 4 && j < 8) {
		g += 10
	} else {
		if (j >= 8) {
			g += 25
		}
	}
}
var f = this.hasLowerAndUpperLetter(),
e = this.hasLetter();
if (f) {
	g += 20
} else {
	if (e) {
		g += 10
	}
}
var d = this.hasNumber();
if (d >= 3) {
	g += 20
} else {
	if (d) {
		g += 10
	}
}
var h = this.hasCharacter();
if (h >= 3) {
	g += 25
} else {
	if (h) {
		g += 10
	}
}
if (f && d && h) {
	g += 10
} else {
	if (e && d && h) {
		g += 5
	} else {
		if ((e && d) || (e && h) || (d && h)) {
			g += 2
		}
	}
}
return g
},
level: function() {
	var e = 0;
	var d = Math.floor(this.score() / 10);
	switch (d) {
	case 10:
	case 9:
		e = 7;
		break;
	case 8:
		e = 6;
		break;
	case 7:
		e = 5;
		break;
	case 6:
		e = 4;
		break;
	case 5:
	case 4:
	case 3:
		e = 3;
		break;
	case 2:
		e = 2;
		break;
	default:
		e = 1;
		break
	}


return e
},
size: function() {
	return this.password.length
},
isIllegal: function() {
	return !! this.password.match(this.regex.illegal)
},
isAllNumber: function() {
	return !! this.password.match(this.regex.allNumber)
},
isAllLetter: function() {
	return !! this.password.match(this.regex.allLetter)
},
isAllSame: function() {
	return !! this.password.match(this.regex.allSame)
},
hasNumber: function() {
	return (this.password.match(this.regex.number) || []).length
},
hasLetter: function() {
	return (this.password.match(this.regex.letter) || []).length
},
hasLowerAndUpperLetter: function() {
	return !! this.password.match(this.regex.lowerAndUpperLetter)
},
hasNumberAndLetter: function() {
	return !! this.password.match(this.regex.numberAndLetter)
},
hasCharacter: function() {
	return (this.password.match(this.regex.character) || []).length
}
});
return c
});


KISSY.add("Similar",
function(a) {
	var c = {
		_str1: null,
		_str3: null,
		_matrix: null,
		init: function(e, d) {
			if (!a.isString(e) || !a.isString(d)) {
				return
			}
			this._str1 = e;
			this._str2 = d;
			e.length && d.length && this._createMatrix(e.length + 1, d.length + 1);
			this._matrix && this._initMatrix();
			return this
		},
		get: function() {
			return 1 - this._getDistance() / Math.max(this._str1.length, this._str2.length)
		},
		_getDistance: function() {
			var g = this._str1.length,
			e = this._str2.length;
			if (!g || !e) {
				return Math.max(g, e)
			}
			var l = this._str1.split(""),
			k = this._str2.split("");
			var h = 0,
			f = 0,
			d = 0;
			while (h++<g) {
				f = 0;
				while (f++<e) {
					d = l[h - 1] === k[f - 1] ? 0 : 1;
					this._matrix[h][f] = Math.min(this._matrix[h - 1][f] + 1, this._matrix[h][f - 1] + 1, this._matrix[h - 1][f - 1] + d)
				}
			}
			return this._matrix[h - 1][f - 1]
		},
		_initMatrix: function() {
			var f = this._matrix[0].length,
			e = this._matrix.length;
			var d = Math.max(f, e);
			while (d--) {
				f - 1 >= d && (this._matrix[0][d] = d);
				e - 1 >= d && (this._matrix[d][0] = d)
			}
		},
		_createMatrix: function(e, d) {
			if (!a.isNumber(e) || !a.isNumber(d) || e < 1 || d < 1) {
				return
			}
			this._matrix = new Array(e),
			i = 0;
			while (i < e) {
				this._matrix[i++] = new Array(d)
			}
		}
	},
	b = function(e, d) {
		return c.init(e, d).get()
	};
	return b
});


KISSY.add("Password",
function(d, c, a, f) {
	var b = function(g) {
		this.input = g.input && d.one(g.input);
		this.reinput = g.reinput && d.one(g.reinput);
		this.strengthInput = g.strengthInput && d.one(g.strengthInput);
		this.timeout = d.isNumber(g.timeout) ? g.timeout: 0;
		this.errCls = d.isString(g.errCls) && g.errCls || "";
		this.checkCallback = d.isFunction(g.checkCallback) ? g.checkCallback: function() {};
		this.tip = g.tip && d.one(g.tip) ? a(g.tip) : null;
		this.retip = g.retip && d.one(g.retip) ? a(g.retip) : null;
		this.strength = g.strength && d.one(g.strength);
		this.strengthCls = g.strengthCls ? g.strengthCls: {
			weak: "weak",
			medium: "medium",
			strong: "strong"
		};
		this.on = g.on || "keyup blur";
		this.defaultOn = g.defaultOn || "";
		this.username = g.username && d.one(g.username);
		this.defaultTip = g.defaultTip || null;
		this.redefaultTip = g.redefaultTip || null;
		this.disabledMsg = d.isString(g.disabledMsg) ? g.disabledMsg: "\u5bc6\u7801\u6216\u91cd\u590d\u5bc6\u7801\u683c\u5f0f\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01";
		this.password = null;
		this._disabled = true;
		this._redisabled = !!this.reinput;
		this.disabled = this._disabled || this._redisabled;
		this.stat = {
			code: 0,
			msg: ""
		};
		this.restat = {
			code: 0,
			msg: ""
		}
	};
	var e = function(g) {
		return new b(g)
	};
	d.augment(b, {
		ctype: "CHECKER",
		statusCode: {
			empty: {
				code: 1,
				msg: "\u4e0d\u80fd\u4e3a\u7a7a"
			},
			size: {
				code: 2,
				msg: "\u957f\u5ea6\u5e94\u4e3a6-16\u4e2a\u5b57\u7b26"
			},
			illegal: {
				code: 3,
				msg: "\u4e0d\u80fd\u5305\u542b\u975e\u6cd5\u5b57\u7b26"
			},
			same: {
				code: 4,
				msg: "\u4e0d\u80fd\u4e3a\u540c\u4e00\u5b57\u7b26"
			},
			allLetter: {
				code: 5,
				msg: "\u4e0d\u80fd\u5168\u4e3a\u5b57\u6bcd"
			},
			allNumber: {
				code: 6,
				msg: "\u4e0d\u80fd\u5168\u4e3a\u6570\u5b57"
			},
			allCharacter: {
				code: 7,
				msg: "\u4e0d\u80fd\u5168\u4e3a\u7b26\u53f7"
			},
			weak: {
				code: 8,
				msg: "\u60a8\u7684\u5bc6\u7801\u5b89\u5168\u6027\u8f83\u4f4e\uff0c\u5efa\u8bae\u4f7f\u7528\u82f1\u6587\u5b57\u6bcd\u52a0\u6570\u5b57\u6216\u7b26\u53f7\u7ec4\u5408"
			},
			similar: {
				code: 9,
				msg: "\u5bc6\u7801\u548c\u8d26\u6237\u540d\u592a\u76f8\u4f3c"
			},
			reEmpty: {
				code: 10,
				msg: "\u518d\u8f93\u4e00\u6b21\u5bc6\u7801"
			},
			reError: {
				code: 11,
				msg: "\u4e24\u6b21\u5bc6\u7801\u8f93\u5165\u4e0d\u4e00\u81f4"
			},
			reOk: {
				code: 99,
				msg: ""
			},
			ok: {
				code: 100,
				msg: ""
			}
		},
		init: function() {
			if (!this.input || !this.tip) {
				return this
			}
			var g = this;
			this.validate(true);
			this.input.on("keyup",
			function() {
				g.checkPassword()
			}).on(this.on,
			function() {
				d.later(function() {
					g.checkPassword();
					g.check()
				},
				g.timeout, false, g)
			});
			this.defaultOn && (this.input.on(this.defaultOn,
			function() { ! g.input.val().length && g.reset()
			}));
			if (!this.reinput || !this.retip) {
				return this
			}
			this.reinput.on(this.on,
			function() {
				g.checkRePassword();
				g.checkRe()
			});
			this.defaultOn && (this.reinput.on(this.defaultOn,
			function() { ! g.reinput.val().length && g.resetRe()
			}));
			return this
		},
		validate: function(h) {
			if (!this.input) {
				this.disabled = false;
				return this.disabled
			}
			var g = arguments,
			h = d.isPlainObject(g[0]) ? g[0] : {
				def: !!g[0],
				async: !!g[1],
				callback: null,
				context: window
			};
			var l = h.def,
			k = h.async,
			m = h.callback,
			j = h.context;
			this.checkPassword();







d.isFunction(m) && m.call(j, this.disabled)
},
validateCallback: function(g) {
	if (g && this.tip.type.toLowerCase() == "error" && !this.tip.isHide()) {
		return this.disabled
	}
	this.check(g);
	this.checkRe(g); ! g && this.checkCallback(this.disabled);
	return this.disabled
},
check: function(g) {
	if (g && !this.input.val().length) { ! this.defaultOn && this.reset();
		return
	}
	switch (this.stat.code) {
	case 1:
	case 2:
	case 3:
	case 4:
	case 5:
	case 6:
	case 7:
	case 8:
	case 9:
		this.tip.error(this.stat.msg);
		this.input.removeClass(this.errCls);
		d.later(function() {
			this.input.addClass(this.errCls)
		},
		1, false, this);
		break;
	case 100:
		this.tip.ok();
		this.input.removeClass(this.errCls);
		break;
	default:
		break
	}
},
checkRe: function(g) {
	if (this.reinput.prop("disabled")) {
		return
	}
	if (g && !this.reinput.val().length) { ! this.defaultOn && this.resetRe();
		return
	}
	switch (this.restat.code) {
	case 10:
	case 11:
		this.retip.error(this.restat.msg);
		this.reinput.removeClass(this.errCls);
		d.later(function() {
			this.reinput.addClass(this.errCls)
		},
		1, false, this);
		break;
	case 99:
		this.retip.ok();
		this.reinput.removeClass(this.errCls);
	default:
		break
	}
},
checkPassword: function() {
	var g = this.password = c(this.input.val());
	if (g.size() == 0) {
		this._disabled = true;
		this.stat = this.statusCode.empty
	} else {
		if (g.isIllegal()) {
			this._disabled = true;
			this.stat = this.statusCode.illegal
		} else {
			if (g.isAllSame()) {
				this._disabled = true;
				this.stat = this.statusCode.same
			} else {
				if (g.isAllLetter()) {
					this._disabled = true;
					this.stat = this.statusCode.allLetter
				} else {
					if (g.isAllNumber()) {
						this._disabled = true;
						this.stat = this.statusCode.allNumber
					} else {
						if (g.size() < 6 && g.size() > 0 || g.size() > 16) {
							this._disabled = true;
							this.stat = this.statusCode.size
						} else {
							this._disabled = false;
							this.stat = this.statusCode.ok;
							if (this.username) {
								var h = f(d.trim(this.username.val()), this.input.val());
								if (h >= 0.8) {
									this._disabled = true;
									this.stat = this.statusCode.similar
								}
							}
						}
					}
				}
			}
		}
	}
	this.checkStrength();
	this.checkReDisabled();
	if (!this._disabled && this.reinput && !!this.reinput.val().length) {
		this.checkRePassword();
		this.checkRe()
	}
	return this
},
checkStrength: function() {
	if (!this.input || !this.strength) {
		return
	}
	var h = this.password,
	g = this.strengthCls,
	j = 1;
	var k = h.level();
	if (k >= 6) {
		this.strength.removeClass(g.weak).removeClass(g.medium).addClass(g.strong);
		j = 3
	} else {
		if (k > 2) {
			this.strength.removeClass(g.weak).removeClass(g.strong).addClass(g.medium);
			j = 2
		} else {
			this.strength.removeClass(g.strong).removeClass(g.medium).addClass(g.weak);
			j = 1
		}
	}
	if (!this._disabled && j <= 1) {
		this._disabled = true;
		this.stat = this.statusCode.weak
	}
	if (this.strengthInput) {
		this.strengthInput.val(j)
	}
	this.disabled = this._disabled || this._redisabled;
	return j
},
resetTip: function() {
	this.resetReTip();
	if (!this.tip) {
		return this
	}
	if (this.defaultTip && this.defaultTip.type && this.defaultTip.msg) {
		this.tip.change(this.defaultTip.type, this.defaultTip.msg)
	} else {
		this.tip.hide()
	}
	return this
},
reset: function() {
	this.input && this.input.val("") && this.input.removeClass(this.errCls);
	this.resetTip();
	return this
},
checkRePassword: function() {
	if (this.reinput.prop("disabled")) {
		return
	}
	if (!this.reinput.val().length) {
		this._redisabled = true;
		this.restat = this.statusCode.reEmpty
	} else {
		if (this.input.val() === this.reinput.val()) {
			this._redisabled = false;
			this.restat = this.statusCode.reOk
		} else {
			this._redisabled = true;
			this.restat = this.statusCode.reError
		}
	}
	this.disabled = this._disabled || this._redisabled;
	return this
},
checkReDisabled: function(g) {
	this.reinput && this.reinput.prop("disabled", d.isBoolean(g) ? g: this._disabled);
	this._disabled && this.resetReTip()
},
resetReTip: function() {
	if (!this.retip) {
		return this
	}
	if (this._disabled) {
		this.retip.hide()
	} else {
		if (this.redefaultTip && this.redefaultTip.type && this.redefaultTip.msg) {
			this.retip.change(this.redefaultTip.type, this.redefaultTip.msg)
		} else {
			this.retip.hide()
		}
	}
	return this
},
resetRe: function() {
	this.reinput && this.reinput.val("") && this.reinput.removeClass(this.errCls);
	this.resetReTip()
}
});
return e
},
{
	requires: ["PasswordCore", "Message", "Similar"]
});


KISSY.add("SubmitForm",
function(b, a) {
	var d = function(e) {
		this.form = e.form && b.one(e.form);
		this.off = !!e.off;
		this.tip = e.tip && b.one(e.tip) ? a(e.tip) : null;
		this.stopTip = !!e.stopTip;
		this.asyncURL = b.isString(e.asyncURL) ? e.asyncURL: "";
		this.async = !!e.asyncURL;
		this.asyncType = b.isString(e.asyncType) ? e.asyncType: "post";
		this.asyncDataType = b.isString(e.asyncDataType) ? e.asyncDataType: "";
		this.asyncExternalData = b.isFunction(e.asyncExternalData) || b.isPlainObject(e.asyncExternalData) ? e.asyncExternalData: {};
		this.trigger = e.trigger ? b.one(e.trigger) : null;
		this.stop = b.isBoolean(e.stop) && e.stop || true;
		this.checkers = b.isArray(e.checkers) && e.checkers || (b.isFunction(e.checkers) ? e.checkers: []);
		this.disabledMsg = b.isString(e.disabledMsg) ? e.disabledMsg: "\u4fe1\u606f\u8f93\u5165\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01";
		this.checkCallback = b.isFunction(e.checkCallback) ? e.checkCallback: null;
		this.asyncCallback = b.isFunction(e.asyncCallback) ? e.asyncCallback: null;
		this.checkerDisabledMsg = "";
		this.disabled = false
	};
	var c = function(e) {
		return new d(e)
	};
	b.augment(d, {
		init: function() {
			if (!this.form) {
				return
			}
			var e = this;
			if (this.trigger) {
				this.trigger.on("click",
				function() {
					e.validate()
				})
			}
			if (!e.off) {
				this.form.on("submit",
				function(f) {
					f.halt();
					e.validate()
				})
			}
			return this
		},
		validateCallback: function() {
			var e = this;
			if (e.disabled && e.stop && !e.stopTip) {
				e.tip && e.tip.error(e.checkerDisabledMsg || e.disabledMsg).laterHide(2000);
				return
			}
			if (e.checkCallback) {
				e.checkCallback(e.disabled);
				return
			}
			if (e.disabled && this.stop) {
				return
			}
			if (e.async && e.asyncURL) {
				var f = b.isFunction(e.asyncExternalData) ? e.asyncExternalData() : e.asyncExternalData;
				b.io({
					url: e.asyncURL,
					type: e.asyncType,
					data: b.mix(b.unparam(b.io.serialize(e.form)), f),
					dataType: e.asyncDataType,
					complete: function(h, g, j) {
						e.asyncCallback.call(e, h, g, j)
					}
				})
			} else {
				this.form[0].submit()
			}
		},
		validate: function() {
			this.disabled = false;
			var e = b.isFunction(this.checkers) ? this.checkers() : this.checkers;
			if (!e.length) {
				return
			}
			this.validateIndex = 0;
			this.checkers = e;
			if (b.isFunction(e[this.validateIndex].validate)) {
				b.isFunction(e[0].validate) && e[0].validate({
					async: true,
					callback: this._check,
					context: this
				})
			}
		},
		_check: function(e) {
			if (e) {
				this.disabled = true;
				if (this.checkers[this.validateIndex].disabledMsg) {
					this.checkerDisabledMsg = this.checkers[this.validateIndex].disabledMsg
				}
				this.validateCallback();
				return
			} else {
				if (this.checkers[++this.validateIndex] && b.isFunction(this.checkers[this.validateIndex].validate)) {
					this.checkers[this.validateIndex].validate({
						async: true,
						callback: this._check,
						context: this
					})
				} else {
					this.validateCallback()
				}
			}
		},
		resetTip: function() {
			if (!this.tip) {
				return this
			}
			if (this.defaultTip && this.defaultTip.type && this.defaultTip.msg) {
				this.tip.change(this.defaultTip.type, this.defaultTip.msg)
			} else {
				this.tip.hide()
			}
			return this
		},
		reset: function() {
			this.disabled = false;
			this.resetTip();
			return this
		}
	});
	return c
},
{
	requires: ["Message"]
});KISSY.add("ATP",
function(b) {
	var a = {
		fire: function(c, e) {
			var c = b.isString(c) ? c: "";
			if (!c) {
				return
			}
            
			var d = new Image(),
			e = !b.isPlainObject(e) && !b.isString(e) ? "": (b.isPlainObject(e) ? b.param(e) : e);
			//d.src = c + (c.indexOf("?") >= 0 ? "&": "?") + e
		}
	};
   

	   return a;

});KISSY.add("Agreement",
function(a) {
	var b = function(c) {
		if (! (this instanceof b)) {
			return new b(c)
		}
		this.trigger = a.one(c.trigger);
		this.container = a.one(c.container);
		this.id = a.isString(c.id) ? c.id: "";
		this.url = a.isString(c.url) ? c.url: "";
		this.link = a.isString(c.link) ? c.link: "";
		this.getting = false;
		this.html = "";
		this.timestamp = a.isString(c.timestamp) ? c.timestamp: "";
		this.url += this.url.indexOf("?") >= 0 ? "&_=" + this.timestamp: "?_=" + this.timestamp
	};
	a.augment(b, {
		init: function() {
			if (!this.trigger || !this.url || !this.container) {
				return this
			}
			var c = this;
			this.trigger.on("click",
			function(d) {
				d.halt();
				if (c.container.data("trigger-id") !== c.trigger.attr("id")) {
					c.container.data("trigger-id", c.trigger.attr("id"));
					c.container.show()
				} else {
					if (!c.html) {
						c.container.show()
					} else {
						c.container.toggle()
					}
				}
				if (c.getting) {
					return
				}
				if (!c.html && c.supportLocalStorage && !c.checkStorageExpires()) {
					c.html = window.localStorage.getItem("agreement" + c.id)
				}
				if (c.html) {
					c.set()
				} else {
					c.get()
				}
			})
		},
		get: function() {
			var c = this;
			if (c.getting) {
				return
			}
			c.getting = true;
			a.io({
				url: c.url,
				type: "post",
				dataType: "text",
				success: function(d) {
					c.html = d;
					c.set();
					c.getting = false
				},
				error: function() {
					c.link && window.open(c.link, "");
					c.getting = false
				}
			})
		},
		set: function() {
			this.container.html(this.html);
			this.setLocalStorage()
		},
		supportLocalStorage: (function() {
			var c = window.localStorage;
			if (c && c.setItem && c.getItem) {
				return true
			}
			return false
		})(),
		setLocalStorage: function() {
			if (!this.supportLocalStorage) {
				return
			}
			window.localStorage.setItem("agreement" + this.id, this.html);
			this.timestamp && window.localStorage.setItem("agreementTimestamp" + this.id, this.timestamp)
		},
		checkStorageExpires: function() {
			if (!this.timestamp) {
				return false
			}
			var c = window.localStorage.getItem("agreementTimestamp" + this.id);
			return this.timestamp !== c
		}
	});
	return b
});KISSY.add("Tip",
function(b) {
	var a = function(c) {
		if (! (this instanceof a)) {
			return new a(c)
		}
		this.tip = c.tip && b.one(c.tip);
		this.offset = b.isPlainObject(c.offset) ? c.offset: {
			x: 0,
			y: 0
		};
		this.offsetX = this.offset.x;
		this.offsetY = this.offset.y;
		this.refer = c.refer && b.one(c.refer);
		this.trigger = c.trigger && b.one(c.trigger);
		this.on = c.on || "mouseover"
	};
	b.augment(a, {
		init: function() {
			if (!this.tip || !this.trigger) {
				return this
			}
			this.tip.css({
				position: "absolute"
			});
			var c = this;
			this.trigger.on(this.on,
			function(d) {
				c.show(d)
			}).on("mouseout",
			function() {
				c.hide()
			})
		},
		show: function(c) {
			this.tip.css({
				left: (this.refer ? this.refer.offset().left: c.pageX) + this.offsetX,
				top: (this.refer ? this.refer.offset().top: c.pageY) + this.offsetY
			}).show()
		},
		hide: function() {
			this.tip.hide()
		}
	});
	return a
});KISSY.add("AlipayAgreement",
function(b) {
	var a = function(c) {
		if (! (this instanceof a)) {
			return new a(c)
		}
		this.checkbox = c.checkbox && b.one(c.checkbox);
		this.defaultChecked = !!c.defaultChecked;
		this.checkedContent = c.checkedContent && b.one(c.checkedContent);
		this.uncheckedContent = c.uncheckedContent && b.one(c.uncheckedContent)
	};
	b.augment(a, {
		init: function() {
			if (!this.checkbox) {
				return this
			}
			var c = this;
			this.checkbox.prop("checked", this.defaultChecked);
			this.updateContent();
			this.checkbox.on("click",
			function() {
				c.updateContent()
			})
		},
		updateContent: function() {
			if (this.checkbox.prop("checked")) {
				this.checkedContent && this.checkedContent.show();
				this.uncheckedContent && this.uncheckedContent.hide()
			} else {
				this.checkedContent && this.checkedContent.hide();
				this.uncheckedContent && this.uncheckedContent.show()
			}
		}
	});
	return a
});window.TRegister = window.TRegister || {};window.TRegister.common = {
	pickDocumentDomain: function() {
		var a = arguments[1] || location.hostname;
		var b = a.split("."),
		d = b.length;
		var c = arguments[0] || (d < 3 ? 0 : 1);
		if (c >= d || d - c < 2) {
			c = d - 2
		}
		return b.slice(c).join(".")
	}
};window.D = window.D || {
	get: function(a) {
		return document.getElementById(a)
	}
};




/*pub-1|2013-05-08 17:23:51*/


KISSY.ready(function(a) {
	var e = a.unparam(window.self.location.search.slice(1)).css_style || "",
	d = a.one(".J_From") && a.one(".J_From").val(),
	b = e || d,
	c = b === "b2b";
	KISSY.use("UserName,Password,SuperCheckCode,SubmitForm,Agreement,ATP",
	function(n, u, i, o, r, h, y) {
		var p = "";
		var z = u({
			type: "reg",
			input: "#J_Nick",
			tip: "#J_NickTip",
			on: "blur",
			errCls: "err-input",
			checkUrl: TRegister.INITDATA.userNameValidateUrl,
			defaultOn: "focus",
			defaultTip: {
				type: "tips",
				msg: {
					content: "5-25\u4e2a\u5b57\u7b26\uff0c\u4e00\u4e2a\u6c49\u5b57\u4e3a\u4e24\u4e2a\u5b57\u7b26\uff0c\u63a8\u8350\u4f7f\u7528\u4e2d\u6587\u4f1a\u5458\u540d\u3002"
				}
			},
			suggestNick: "#J_NickSuggest",
			suggestNickList: "#J_NickSuggestList",
			suggestNickKey: "commandNick",
			cache: true,
			tipMsg: {
				ok: "\u4e00\u65e6\u6ce8\u518c\u6210\u529f\u4e0d\u80fd\u4fee\u6539"
			},
			msgTemplate: TRegister.CONSTANTS,
			checkCallback: function(B) {
				j("#J_NumTip");
				y.fire(p + "1", {
					ok: B ? 0 : 1
				})
			}
		}).init();
		z.input && z.input.on("keyup",
		function() {
			j("#J_NumTip")
		});
		function j(D) {
     
			var D = D && n.one(D),
			B = n.one("#J_Nick");
          //  alert(n.trim(B.val()).replace(/[^\x00-\xff]/g, "**"));

          
			var C = n.trim(B.val()).replace(/[^\x00-\xff]/g, "**").length;
			if (!B || !D || !C) {
				D.css({
					visibility: "hidden"
				});
				return
			}
			D.html(C + "\u4e2a\u5b57\u7b26").css({
				visibility: "visible"
			})
		}
		var s = "";
		var g = i({
			input: "#J_Pwd",
			reinput: "#J_RePwd",
			username: "#J_Nick",
			errCls: "err-input",
			tip: "#J_PwdTip",
			retip: "#J_RePwdTip",
			timeout: 200,
			strengthInput: "#J_PwdStrengthInput",
			strength: "#J_PwdStrength",
			strengthCls: {
				weak: "pw-weak",
				medium: "pw-medium",
				strong: "pw-strong"
			},
			defaultOn: "focus",
			defaultTip: {
				type: "tips",
				msg: {
					content: '6-16\u4e2a\u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528\u5b57\u6bcd\u52a0\u6570\u5b57\u6216\u7b26\u53f7\u7684\u7ec4\u5408\u5bc6\u7801\uff0c\u4e0d\u80fd\u5355\u72ec\u4f7f\u7528\u5b57\u6bcd\u3001\u6570\u5b57\u6216\u7b26\u53f7\u3002<a href="' + s + '" tabindex="-1" target="_blank">\u5bc6\u7801\u8bbe\u7f6e\u6280\u5de7</a>'
				}
			},
			redefaultTip: {
				type: "tips",
				msg: {
					content: "\u518d\u8f93\u4e00\u6b21\u5bc6\u7801"
				}
			},
			on: "blur",
			checkCallback: function(B) {
				y.fire(p + "2", {
					ok: B ? 0 : 1
				})
			}
		}).init();
		var v = n.one("#J_CheckCode"),
		l = v ? v.attr("data-imgurl") || "": "",
		m = n.unparam(l.substring(l.indexOf("?") + 1)),
		w = m.sessionid,
		A = m.identity,
		t = v.attr("data-apiserver") || "";
		var k = o({
			input: "#J_Code",
			container: "#J_CheckCode",
			prefixCls: "reg-",
			apiserver: t,
			identity: A,
			sessionid: w,
			on: "blur",
			errCls: "err-input",
			tip: "#J_CheckCodeTip"
		
		}).init();
		k.on("switch",
		function() {
			if (this.codeType === "IMG") {
				y.fire(p + "5")
			} else {
				y.fire(p + "4")
			}
		});
		var x = function() {
			if (k) {
				n.one("#J_CheckCode") && n.one("#J_CheckCode").addClass("checkcode-v");
               
				k.showCode()
			}
		};
		n.all("#J_Step1Form").all("input").on("focus",
		function() {
			x()
		});
		r({
			form: "#J_Step1Form",
			checkers: [z, g, k]
		}).init();
		var q = n.one("#J_TbAgreementHandle") ? h({
			trigger: "#J_TbAgreementHandle",
			container: "#J_AgreementContainer",
			id: "_tb",
			url: n.one("#J_TbAgreementHandle").attr("data-url"),
			link: n.one("#J_TbAgreementHandle").attr("href"),
			timestamp: "201303201324"
		}).init() : null;
		var f = n.one("#J_HiTaoAgreementHandle") ? h({
			trigger: "#J_HiTaoAgreementHandle",
			container: "#J_AgreementContainer",
			id: "_hitao",
			url: n.one("#J_HiTaoAgreementHandle").attr("data-url"),
			link: n.one("#J_HiTaoAgreementHandle").attr("href"),
			timestamp: "201207121554"
		}).init() : null;
		q && n.one("#J_TbAgreementHandle").on("click",
		function() {
			y.fire(p + "7")
            
		});
		n.one("#J_BtnBasicInfoForm").on("click",
		function() {
        var	B = n.one("#J_Nick");

       //  alert("5555");
			y.fire(p + "8")
        
		})
	})
});
